home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
16
/
printer.fth
< prev
next >
Wrap
Text File
|
1985-11-19
|
2KB
|
73 lines
\ Printer control.
\ This hasn't been tested very well because I don't have a printer.
\
\ Defines a vocabulary called printer which contains:
\
\ (print) ( char -- ) Output a character to the printer
\ print Subsequent output goes to both printer and screen
\ until the next Forth prompt
\ print-file filename Print the named file
\
\ Setting the printer parameters: Execute the appropriate commands from
\ this list, then execute set-printer (or use the desk accessory)
\
\ dot-matrix or daisy-wheel
\ color or monochrome
\ atari or epson
\ draft or final
\ parallel or serial
\ form-feed or single-sheet
decimal
only forth also definitions
vocabulary printer printer definitions
only forth also printer also definitions
33 xbios: setprt { w.config -- w.old-config }
wvariable printer-config 0 printer-config w!
: set-printer ( -- ) printer-config w@ setprt drop ;
: pset ( mask -- ) printer-config w@ or printer-config w! ;
: pclr ( mask -- ) not printer-config w@ or printer-config w! ;
hex
: dot-matrix 1 pclr ; : daisy-wheel 1 pset ;
: color 2 pclr ; : monochrome 2 pset ;
: atari 4 pclr ; : epson 4 pset ;
: draft 8 pclr ; : final 8 pset ;
: parallel 10 pclr ; : serial 10 pset ;
: form-feed 20 pclr ; : single-sheet 20 pset ;
decimal
5 bdos: c_prnout { w.char -- }
alias (print) c_prnout
: premit ( char -- ) dup (print) sys-emit ;
only forth printer also forth hidden also forth definitions
: print ( -- ) \ turn printer on
['] status >data token@ old-status token!
['] console-output is status
['] premit is (emit
;
: (print-file ( -- )
begin ifd @ fgetc dup 0>=
while (print)
repeat
drop ifd @ close
;
: print-file \ filename ( -- )
reading (print-file
;
only forth also definitions
jmp
d1 a0 ) lmove
then
2 a0 addq
repeat
c;
\ Change all the next routines in